package com.bytedance.frameworks.a.a;

import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.AttributeSet;
import android.view.View;

import icepick.Icepick;
import im.quar.autolayout.utils.AutoLayoutHelper;

public abstract class AutoLayoutActivity extends AppCompatActivity {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Icepick.restoreInstanceState(this, savedInstanceState);
    }

    public View onCreateView(String name, Context context, AttributeSet attrs) {
        View view = AutoLayoutHelper.createAutoLayoutView(name, context, attrs);
        if (view == null) {
            view = super.onCreateView(name, context, attrs);
        }
        return view;
    }

    public void onSaveInstanceState(Bundle bundle) {
        super.onSaveInstanceState(bundle);
        Icepick.saveInstanceState(this, bundle);
    }
}

